﻿/***********************************************************************
 * <copyright file="User.cs" company="B/S JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   SonHB
 * Email:    sonhb@newman.vn
 * Website:
 * Create Date: Saturday, November 9, 2013
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using System;
using System.Collections.Generic;
using BusinessObjects;
using BusinessObjects.BusinessRules;

namespace BusinessSecurity
{
    /// <summary>
    /// User class
    /// </summary>
    public class User : BusinessObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="User" /> class.
        /// </summary>
        public User()
        {
            AddRule(new ValidateId("UserId"));
            AddRule(new ValidateRequired("UserName"));
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="User" /> class.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <param name="isActive">if set to <c>true</c> [is active].</param>
        /// <param name="isApproved">if set to <c>true</c> [is approved].</param>
        /// <param name="isBlocked">if set to <c>true</c> [is blocked].</param>
        /// <param name="lastActivityDate">The last activity date.</param>
        /// <param name="fullName">The full name.</param>
        /// <param name="email">The email.</param>
        /// <param name="address">The address.</param>
        /// <param name="createdDate">The created date.</param>
        /// <param name="roles">The roles.</param>
        public User(int userId, string userName, string password, bool isActive, bool isApproved,
                    bool isBlocked, DateTime lastActivityDate, string fullName, string email, string address,DateTime createdDate,
                    List<Role> roles)
        {
            UserId = userId;
            UserName = userName;
            Password = password;
            IsActive = isActive;
            IsApproved = isApproved;
            IsBlocked = isBlocked;
            LastActivityDate = lastActivityDate;
            FullName = fullName;
            Email = email;
            Address = address;
            CreateDate = createdDate;
            Roles = roles;
        }

        /// <summary>
        ///     Gets or sets the user identifier.
        /// </summary>
        /// <value>
        ///     The user identifier.
        /// </value>
        public int UserId { get; set; }

        /// <summary>
        ///     Gets or sets the name.
        /// </summary>
        /// <value>
        ///     The name.
        /// </value>
        public string UserName { get; set; }

        /// <summary>
        ///     Gets or sets the password.
        /// </summary>
        /// <value>
        ///     The password.
        /// </value>
        public string Password { get; set; }

        /// <summary>
        ///     Gets or sets a value indicating whether [is active].
        /// </summary>
        /// <value>
        ///     <c>true</c> if [is active]; otherwise, <c>false</c>.
        /// </value>
        public bool IsActive { get; set; }

        /// <summary>
        ///     Gets or sets a value indicating whether [is approved].
        /// </summary>
        /// <value>
        ///     <c>true</c> if [is approved]; otherwise, <c>false</c>.
        /// </value>
        public bool IsApproved { get; set; }

        /// <summary>
        ///     Gets or sets a value indicating whether [is blocked].
        /// </summary>
        /// <value>
        ///     <c>true</c> if [is blocked]; otherwise, <c>false</c>.
        /// </value>
        public bool IsBlocked { get; set; }

        /// <summary>
        ///     Gets or sets the last activity date.
        /// </summary>
        /// <value>
        ///     The last activity date.
        /// </value>
        public DateTime LastActivityDate { get; set; }

        /// <summary>
        ///     Gets or sets the full name.
        /// </summary>
        /// <value>
        ///     The full name.
        /// </value>
        public string FullName { get; set; }

        /// <summary>
        ///     Gets or sets the email.
        /// </summary>
        /// <value>
        ///     The email.
        /// </value>
        public string Email { get; set; }

        /// <summary>
        ///     Gets or sets the address.
        /// </summary>
        /// <value>
        ///     The address.
        /// </value>
        public string Address { get; set; }

        /// <summary>
        /// Gets or sets the created date.
        /// </summary>
        /// <value>
        /// The created date.
        /// </value>
        public DateTime CreateDate { get; set; }

        /// <summary>
        /// Gets or sets the unit identifier.
        /// </summary>
        /// <value>
        /// The unit identifier.
        /// </value>
        public long UnitId { get; set; }

        /// <summary>
        ///     Gets or sets the roles.
        /// </summary>
        /// <value>
        ///     The roles.
        /// </value>
        public List<Role> Roles { get; set; }
    }

    /// <summary>
    /// RecoverPassword
    /// </summary>
    public class RecoverPassword : BusinessObject
    {        

        /// <summary>
        /// Gets or sets the email.
        /// </summary>
        /// <value>
        /// The email.
        /// </value>
        public string Email { get; set; }
        /// <summary>
        /// Gets or sets the name of the user.
        /// </summary>
        /// <value>
        /// The name of the user.
        /// </value>
        public string UserName { get; set; }
        /// <summary>
        /// Gets or sets the verify.
        /// </summary>
        /// <value>
        /// The verify.
        /// </value>
        public string Verify { get; set; }
    }
}